package com.lglbc.democase.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.List;

/**
 * @author： 乐哥聊编程(全平台同号)
 */
@Configuration
/**
 * @author： 乐哥聊编程(全平台同号)
 */
public class RestTemplateConfig {

   @Bean
   public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
       return new RestTemplate(factory);
   }

   @Bean
   public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
       SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
       factory.setReadTimeout(150000); // ms
       factory.setConnectTimeout(150000); // ms
       return factory;
   }

   public static void main(String[] args) {
      List<String> a = new ArrayList<>();
      a.add(null);
      a.add(null);
      a.add(null);
      a.add(null);
      a.add(null);
      for (String value:a){
         System.out.printf(value.hashCode()+"");
      }
   }
}

